﻿<h1>CheckBox Control Example</h1>
This example explains how to create a simple window with CheckBox controls, bind to the data and show on the screen.<br>
<button id="CheckBoxControlExample" class="try-example-button">Try Example</button>
<h2>UI Model</h2>
<div style="color:Black;background-color:White;"><pre>{
    <span style="color:#A31515;">"windows"</span>: [
        {
            <span style="color:#A31515;">"name"</span>: <span style="color:#A31515;">"CheckBoxExample"</span>,
            <span style="color:#A31515;">"title"</span>: <span style="color:#A31515;">"CheckBox Example"</span>,
            <span style="color:#A31515;">"left"</span>: 500,
            <span style="color:#A31515;">"top"</span>: 100,
            <span style="color:#A31515;">"width"</span>: 400,
            <span style="color:#A31515;">"height"</span>: 300,
            <span style="color:#A31515;">"controls"</span>: [
                <b>{
                    <span style="color:#A31515;">"name"</span>: <span style="color:#A31515;">"canWalkCheckBox"</span>,
                    <span style="color:#A31515;">"type"</span>: <span style="color:#A31515;">"checkbox"</span>,
                    <span style="color:#A31515;">"label"</span>: <span style="color:#A31515;">"Can Walk"</span>,
                    <span style="color:#A31515;">"bindsTo"</span>: <span style="color:#A31515;">"canWalk"</span>
                },
                {
                    <span style="color:#A31515;">"name"</span>: <span style="color:#A31515;">"canFlyCheckBox"</span>,
                    <span style="color:#A31515;">"type"</span>: <span style="color:#A31515;">"checkbox"</span>,
                    <span style="color:#A31515;">"label"</span>: <span style="color:#A31515;">"Can Fly"</span>,
                    <span style="color:#A31515;">"bindsTo"</span>: <span style="color:#A31515;">"canFly"</span>
                },
                {
                    <span style="color:#A31515;">"name"</span>: <span style="color:#A31515;">"canSwimCheckBox"</span>,
                    <span style="color:#A31515;">"type"</span>: <span style="color:#A31515;">"checkbox"</span>,
                    <span style="color:#A31515;">"label"</span>: <span style="color:#A31515;">"Can Swim"</span>,
                    <span style="color:#A31515;">"bindsTo"</span>: <span style="color:#A31515;">"canSwim"</span>
                }</b>,
                {
                    <span style="color:#A31515;">"name"</span>: <span style="color:#A31515;">"OKButton"</span>,
                    <span style="color:#A31515;">"type"</span>: <span style="color:#A31515;">"button"</span>,
                    <span style="color:#A31515;">"text"</span>: <span style="color:#A31515;">"OK"</span>,
                    <span style="color:#A31515;">"isDialogButton"</span>: <span style="color:Blue;">true</span>,
                    <span style="color:#A31515;">"dialogResult"</span>: <span style="color:#A31515;">"OK"</span>
                },
                {
                    <span style="color:#A31515;">"name"</span>: <span style="color:#A31515;">"CancelButton"</span>,
                    <span style="color:#A31515;">"type"</span>: <span style="color:#A31515;">"button"</span>,
                    <span style="color:#A31515;">"text"</span>: <span style="color:#A31515;">"Cancel"</span>,
                    <span style="color:#A31515;">"isDialogButton"</span>: <span style="color:Blue;">true</span>,
                    <span style="color:#A31515;">"dialogResult"</span>: <span style="color:#A31515;">"Cancel"</span>
                }
            ]
        }
    ]
}
</pre></div>
<h2>Data Model</h2>
<div style="color:Black;background-color:White;"><pre><span style="color:Blue;">var</span> animalData = {
	canWalk: <span style="color:Blue;">true</span>,
	canFly: <span style="color:Blue;">false</span>,
	canSwim: <span style="color:Blue;">true</span>
};
</pre></div>
<h2>Code</h2>
<div style="color:Black;background-color:White;"><pre><span style="color:Blue;">var</span> exampleWindow = redui.createNewWindow(<span style="color:#A31515;">"CheckBoxExample"</span>);
exampleWindow.bind(animalData);
exampleWindow.show();
</pre>